package com.zpark.springboottest.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@AllArgsConstructor
@NoArgsConstructor
@Data
public class User {
    @NotNull(message = "id不能为空,") // 用于基本数据类型
    private Integer id;


    @NotBlank(message = "用户名不能为空")  // 用于String数据类型
    @Pattern(regexp = "/^(?=.*\\d)(?=.*[A-z])[\\da-zA-Z]{1,9}$/",
            message= "只能由字母、数字组成，1-9位")
    private String username;


    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "/^(?=.*\\d)(?=.*[a-zA-Z])(?=.*[^\\da-zA-Z\\s]).{1,9}$/ ",
            message = "至少包含字母、数字、特殊字符，1-9位")
    private String password;
}
